<?php
/**
 * Created by PhpStorm
 * User: whh
 * Date: 2022/7/28
 * Time: 16:02
 */

namespace app\common\model;


use app\backstage\model\ManagerUser;
use app\backstage\model\QuickAppToManagerAccess;
use think\Model;

class QuickApp extends Model
{
    use Common;

    protected $table = 'quick_app';

    /**
     * 主体公司
     * @return \think\model\relation\HasOne
     * @Author: whh
     */
    public function subject()
    {
        return $this->hasOne(Subject::class, 'id', 'subject_id');
    }

    /**
     * 详情
     * @return \think\model\relation\HasOne
     * @Author: whh
     */
    public function info()
    {
        return $this->hasOne(QuickAppInfo::class, 'quick_id', 'id');
    }

    public function shield()
    {
        return $this->hasOne(QuickShield::class, 'quick_id', 'id');
    }

    public function Manager()
    {
        return $this->belongsToMany(ManagerUser::class, QuickAppToManagerAccess::class, 'uid', 'quick_id');
    }
}